﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.IO;

namespace Microsoft.AspNetCore.Builder
{
    public static class UAuthServerApplicationBuilderExtensions
    {
        public static void UseUAuth(this IApplicationBuilder app, IConfiguration configuration)
        {
            //var config = new ConfigurationBuilder()
            //    .AddInMemoryCollection() // 将配置文件的数据加载到内存中
            //.SetBasePath(Directory.GetCurrentDirectory()) // 指定配置文件所在的目录
            //.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) // 指定加载的配置文件  --划重点..记得始终复制
            //.Build(); //编译成对象

            
        }


        public static void UseUAuthServerApiDoc(this IApplicationBuilder app)
        {
            app.UseSwagger(options =>
            {
                options.RouteTemplate = "/swagger/{documentName}/json";
            })
            .UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint($"/swagger/UAuthApp/json", "UAuthApp  v1.0.0");
            });
        }
    }
}
